import request from '@/config/axios'

// 创建ivr分组
export const createIvrGroup = async (data) => {
  return await request.post({ url: `/call/ivr-group/create`, data })
}
// 删除ivr分组
export const deleteIvrGroup = async (id) => {
  return await request.delete({ url: `/call/ivr-group/delete?id=` + id })
}
// 查询ivr分组列表
export const getIvrGroupPage = async () => {
  return await request.get({ url: `/call/ivr-group/page` })
}
// 创建ivr流程
export const createIvrFlow = async (data) => {
  return await request.post({ url: `/call/ivr-flow/create`, data })
}
// 根据分组id查询流程列表
export const getIvrPage = async (id) => {
  return await request.get({ url: `/call/ivr-flow/page?groupId=` + id })
}
// 更改ivr流程
export const updateIvrFlow = async (data) => {
  return await request.put({ url: `/call/ivr-flow/update`, data })
}
// 删除ivr流程
export const deleteIvrFlow = async (id) => {
  return await request.delete({ url: `/call/ivr-flow/delete?id=` + id })
}
// ivr流程详情
export const getIvr = async (id) => {
  return await request.get({ url: `/call/ivr-flow/get?id=` + id })
}
// ivr流程列表simpList
export const getIvrList = async (id) => {
  return await request.get({ url: `/call/ivr-flow/simple-list?groupId=${id}` })
}
// ivr组的simpList
export const getIvrGroupList = async (id) => {
  return await request.get({ url: `/call/ivr-flow/simple-list` })
}

// 创建知识库分组
export const createIvKnowGroup = async (data) => {
  return await request.post({ url: `/call/ivr-knowledge-group/create`, data })
}
// 查询知识库组列表
export const getIvrKnowGroupPage = async (id, flowId) => {
  return await request.get({ url: `/call/ivr-knowledge-group/page?groupId=${id}&flowId=${flowId}` })
}
// 删除知识库组列表
export const deleteKnowLedgeGroup = async (id) => {
  return await request.delete({ url: `/call/ivr-knowledge-group/delete?id=` + id })
}
// 创建知识库问题
export const createIvrKnowIssue = async (data) => {
  return await request.post({ url: `/call/ivr-knowledge-issue/create`, data })
}
// 查询知识库问题
export const getKnowLedge = async (id) => {
  return await request.get({ url: `/call/ivr-knowledge-issue/get?id=` + id })
}
// 创建知识库问题语音
export const createIvrKnowVoice = async (data) => {
  return await request.post({ url: `/call/ivr-knowledge-issue-voice/create`, data })
}
// 获得知识库语音分页
export const getKnowVoicePage = async (params) => {
  return await request.get({ url: `/call/ivr-knowledge-issue-voice/page`, params })
}
// 删除知识库语音
export const deleteKnowVoice = async (id) => {
  return await request.delete({ url: `/call/ivr-knowledge-issue-voice/delete?id=` + id })
}
// 更改知识库语音
export const updateKnowVoice = async (data) => {
  return await request.put({ url: `/call/ivr-knowledge-issue-voice/update`, data })
}
// 根据分组id查询知识库问题列表
export const getIvrKnowledge = async (params) => {
  return await request.get({
    url: `/call/ivr-knowledge-issue/page`,
    params
  })
}
// 更改问题知识库
export const updateIvrKnow = async (data) => {
  return await request.put({ url: `/call/ivr-knowledge-issue/update`, data })
}
// 删除问题知识库
export const deleteIvrKnow = async (id) => {
  return await request.delete({ url: `/call/ivr-knowledge-issue/delete?id=` + id })
}
// 问题知识库详细
export const getIvrKnowIssue = async (id) => {
  return await request.get({ url: `/call/ivr-knowledge-issue/get?id=` + id })
}
// 创建ivr用户回答语音
export const createIvrFlowVoice = async (data) => {
  return await request.post({ url: `/call/ivr-flow-voice/create`, data })
}
// 根据type查询ivr用户回答语音列表
export const getIvrFlowVoiceByType = async (params) => {
  return await request.get({ url: `/call/ivr-flow-voice/getIvrFlowVoiceByType`, params })
}
// 根据type查询ivr用户回答语音列表分页
export const getIvrFlowVoiceByTypePage = async (params) => {
  return await request.get({ url: `/call/ivr-flow-voice/page`, params })
}
// 删除语音
export const deleteIvrVoice = async (id) => {
  return await request.delete({ url: `/call/ivr-flow-voice/delete?id=` + id })
}

// 获得ivr关键字列表
export const getIvrKeywordsList = async (params) => {
  return await request.get({ url: `/call/ivr-keywords/simple-list`, params })
}

// 转拼音
export const getPinyin = async (params) => {
  return await request.get({ url: `/call/ivr-flow/pinyin`, params })
}

// 流程自己的分支 创建
export const createIvrKeys = async (data) => {
  return await request.post({ url: `/call/ivr-keywords-custom/create`, data })
}
// 流程自己的分支 更新
export const updateIvrKeys = async (data) => {
  return await request.put({ url: `/call/ivr-keywords-custom/update`, data })
}
// 流程自己的分支 查询
export const getIvrKeys = async (params) => {
  return await request.get({ url: `/call/ivr-keywords-custom/simple-list`, params })
}

// 意向标签匹配不到默认标签 查询
export const getByFlowId = async (params) => {
  return await request.get({ url: `/call/ivr-intention-label-not-match/getByFlowId`, params })
}
// 意向标签匹配不到默认标签 更新
export const updateGetByFlowId = async (data) => {
  return await request.put({ url: `/call/ivr-intention-label-not-match/update`, data })
}

// 意向标签 列表
export const getIntentionLabel = async (params) => {
  return await request.get({ url: `/call/ivr-intention-label/page`, params })
}
// 意向标签 创建
export const createIntentionLabel = async (data) => {
  return await request.post({ url: `/call/ivr-intention-label/create`, data })
}
// 意向标签 详情
export const getIntentionLabelDetail = async (id) => {
  return await request.get({ url: `/call/ivr-intention-label/get?id=` + id })
}
// 意向标签 详情
export const deleteIntentionLabel = async (id) => {
  return await request.delete({ url: `/call/ivr-intention-label/delete?id=` + id })
}
// 意向标签 更新
export const updateIntentionLabel = async (data) => {
  return await request.put({ url: `/call/ivr-intention-label/update`, data })
}
// 恢复默认规则
export const recoverDefault = async (params) => {
  return await request.get({ url: `/call/ivr-intention-label/recoverDefault`, params })
}

// ivr录音
// 试听
export const ivrVoiceAudition = async (data) => {
  return await request.post({ url: `/call/ivr-voice/audition`, data })
}
// 流程节点
// 1.0批量生成话术语音
export const createVoiceList = async (data) => {
  return await request.post({ url: `/call/ivr-voice/createVoiceList`, data })
}
// 1.1获取话术列表
export const ivrContentList = async (params) => {
  return await request.get({ url: `/call/ivr-voice/ivrContentList`, params })
}
// 1.2批量删除话术语音
export const delVoiceList = async (params) => {
  return await request.get({ url: `/call/ivr-voice/delVoiceList`, params })
}
// 1.3删除单个语音文件
export const delVoiceByNodeId = async (params) => {
  return await request.get({ url: `/call/ivr-voice/delVoiceByNodeId`, params })
}
// 1.4生成单个语音
export const createVoiceByNodeId = async (data) => {
  return await request.post({ url: `/call/ivr-voice/createVoiceByNodeId`, data })
}
// 2.0 批量生成知识库语音文件
export const knowledgeIssueVoiceListCreate = async (data) => {
  return await request.post({
    url: `/call/ivr-knowledge-issue/knowledgeIssueVoiceListCreate`,
    data
  })
}
// 2.1获取知识库列表
export const KnowledgeIssueByFlowId = async (params) => {
  return await request.get({ url: `/call/ivr-knowledge-issue/KnowledgeIssueByFlowId`, params })
}
// 2.2批量删除知识库语音
export const delKnowledgeIssueVoiceByFlowId = async (params) => {
  return await request.get({
    url: `/call/ivr-knowledge-issue/delKnowledgeIssueVoiceByFlowId`,
    params
  })
}
// 2.3删除单个知识库文件
export const delKnowledgeIssueVoiceById = async (params) => {
  return await request.get({ url: `/call/ivr-knowledge-issue/delKnowledgeIssueVoiceById`, params })
}
// 2.4生成单个知识库语音
export const knowledgeIssueVoiceByIdCreate = async (data) => {
  return await request.post({
    url: `/call/ivr-knowledge-issue/knowledgeIssueVoiceByIdCreate`,
    data
  })
}

// ai角色 获取
export const getRobotRole = async (params) => {
  return await request.get({ url: `/ivr/robot-role/getByFlowId`, params })
}
// ai角色 创建
export const createRobotRole = async (data) => {
  return await request.post({ url: `/ivr/robot-role/create`, data })
}
// ai角色 更改
export const updateRobotRole = async (data) => {
  return await request.put({ url: `/ivr/robot-role/update`, data })
}

// 修改知识库文本
export const updateKnowledgeTxt = async (data) => {
  return await request.put({ url: `/call/ivr-knowledge-issue-voice/update`, data })
}
// 修改流程节点文本
export const upDateIvrContentByNodeId = async (data) => {
  return await request.put({ url: `/call/ivr-voice/upDateIvrContentByNodeId`, data })
}

// 保存录音配置
export const updateIvrRobot = async (data) => {
  return await request.put({ url: `/call/ivr-robot-timbre/update`, data })
}

// ivr 训练
export const irvFlowTraining = async (data) => {
  return await request.post({ url: `/call/ivr-flow/training`, data })
}

// 知识库转默认
export const updateType = async (data) => {
  return await request.post({ url: `/call/ivr-knowledge-issue/updateType`, data })
}
